package de.slothsoft.commons.swing.window;

import java.awt.GridLayout;
import java.awt.Window;

import javax.swing.JPanel;

import de.slothsoft.commons.swing.AboutPanel;
import de.slothsoft.commons.swing.AboutPanel.AboutInfo;

public class AboutDialog extends AbstractDialog {

	private static final long serialVersionUID = 1L;

	private final AboutInfo info;

	public AboutDialog(AboutInfo info) {
		this(null, info);
	}

	public AboutDialog(Window parent, AboutInfo info) {
		super(parent, ButtonType.OK);

		this.info = info;
		setTitle(info.getApplicationTitle());
	}

	@Override
	protected void createMainPanel(JPanel mainPanel) {
		mainPanel.setLayout(new GridLayout(1, 1));
		mainPanel.add(new AboutPanel(this.info));
	}

	@Override
	protected void performOkAction() {
		performCancelAction();
	}

}
